/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.kj.entity;

import com.jeesite.common.mybatis.annotation.JoinTable;
import com.jeesite.common.utils.excel.annotation.ExcelField;
import com.jeesite.common.utils.excel.annotation.ExcelFields;
import org.hibernate.validator.constraints.Length;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;

import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;

import java.math.BigDecimal;
import com.jeesite.common.utils.excel.annotation.ExcelField.Align;
/**
 * kj_project_teamEntity
 * @author hzy
 * @version 2021-07-16
 */
@Table(name="kj_project_team", alias="a", columns={
		@Column(name="id", attrName="id", label="id", isPK=true),
		@Column(name="name", attrName="name", label="团队名", queryType=QueryType.LIKE),
		@Column(name="leader", attrName="kjMember.name", label="团队组织者名", isQuery = false),
		@Column(name="leader_id", attrName="kjMember.id", label="团队组织者ID"),
		@Column(name="headimg", attrName="kjMember.headimg", label="头像", isQuery=false),
		@Column(name="project_id", attrName="kjContributeProject.id", label="项目ID"),
		@Column(name="project_name", attrName="kjContributeProject.name", label="项目名", queryType = QueryType.LIKE),
		@Column(includeEntity=DataEntity.class),
		@Column(name="target_integrals", attrName="targetIntegrals", label="目标积分", isQuery=false),
		@Column(name="contribute", attrName="contribute", label="已捐赠积分", isQuery=false),
		@Column(name="limit_num", attrName="limitNum", label="限制人数", isQuery=false),
		@Column(name="attention_num", attrName="attentionNum", label="已参加人数", isQuery=false),
	}, joinTable={
		@JoinTable(type= JoinTable.Type.LEFT_JOIN, entity= KjMember.class, alias="m",
				on="m.id = a.leader_id",
				columns={@Column(includeEntity=KjMember.class)}),
		@JoinTable(type= JoinTable.Type.LEFT_JOIN, entity= KjContributeProject.class, alias="p",
				on="p.id = a.project_id",
				columns={
						@Column(name="id", label="项目id", isPK=true),
						@Column(name="name", label="项目名", isQuery=false)})
}, orderBy="a.update_date DESC"
)
public class KjProjectTeam extends DataEntity<KjProjectTeam> {

	private static final long serialVersionUID = 1L;
	private String name;		// 团队名
	private String leader;		// 团队组织者名
	private String leaderId;		// 团队组织者ID
	private KjMember kjMember;
	private String headimg;		// 头像
	private String projectId;		// 项目ID
	private String projectName;		// 项目名
	private BigDecimal targetIntegrals;		// 目标积分
	private BigDecimal contribute;		// 已捐赠积分
	private Long limitNum;		// 限制人数
	private Long attentionNum;		// 已参加人数
	private String createDateStr;
	private KjContributeProject kjContributeProject;

	public KjProjectTeam() {
		this(null);
	}

	public KjProjectTeam(String id){
		super(id);
	}

	@Valid
	@ExcelFields({
			@ExcelField(title="团队名", attrName="name", align=Align.CENTER, sort=35),
			@ExcelField(title="团队组织者名", attrName="kjMember.name", align= Align.CENTER, sort=50),
			@ExcelField(title="项目名", attrName="kjContributeProject.name", align=Align.CENTER, sort=55),
			@ExcelField(title="目标积分", attrName="targetIntegrals", align=Align.CENTER, sort=60),
			@ExcelField(title="已捐赠积分", attrName="contribute", align=Align.CENTER, sort=65),
			@ExcelField(title="限制人数", attrName="limitNum", align=Align.CENTER, sort=75),
			@ExcelField(title="已参加人数", attrName="attentionNum", sort=80, width = 25*256),
			})
	@Length(min=0, max=255, message="团队名长度不能超过 255 个字符")
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Length(min=0, max=255, message="团队组织者名长度不能超过 255 个字符")
	public String getLeader() {
		return leader;
	}

	public void setLeader(String leader) {
		this.leader = leader;
	}

	@NotBlank(message="团队组织者ID不能为空")
	@Length(min=0, max=64, message="团队组织者ID长度不能超过 64 个字符")
	public String getLeaderId() {
		return leaderId;
	}

	public void setLeaderId(String leaderId) {
		this.leaderId = leaderId;
	}

	@Length(min=0, max=255, message="头像长度不能超过 255 个字符")
	public String getHeadimg() {
		return headimg;
	}

	public void setHeadimg(String headimg) {
		this.headimg = headimg;
	}

	@Length(min=0, max=64, message="项目ID长度不能超过 64 个字符")
	public String getProjectId() {
		return projectId;
	}

	public void setProjectId(String projectId) {
		this.projectId = projectId;
	}

	@Length(min=0, max=255, message="项目名长度不能超过 255 个字符")
	public String getProjectName() {
		return projectName;
	}

	public void setProjectName(String projectName) {
		this.projectName = projectName;
	}

	public BigDecimal getTargetIntegrals() {
		return targetIntegrals;
	}

	public void setTargetIntegrals(BigDecimal targetIntegrals) {
		this.targetIntegrals = targetIntegrals;
	}

	public BigDecimal getContribute() {
		return contribute;
	}

	public void setContribute(BigDecimal contribute) {
		this.contribute = contribute;
	}

	public Long getLimitNum() {
		return limitNum;
	}

	public void setLimitNum(Long limitNum) {
		this.limitNum = limitNum;
	}

	public Long getAttentionNum() {
		return attentionNum;
	}

	public void setAttentionNum(Long attentionNum) {
		this.attentionNum = attentionNum;
	}

	public KjMember getKjMember() {
		return kjMember;
	}

	public void setKjMember(KjMember kjMember) {
		this.kjMember = kjMember;
	}

	public KjContributeProject getKjContributeProject() {
		return kjContributeProject;
	}

	public void setKjContributeProject(KjContributeProject kjContributeProject) {
		this.kjContributeProject = kjContributeProject;
	}

	public String getCreateDateStr() {
		return createDateStr;
	}

	public void setCreateDateStr(String createDateStr) {
		this.createDateStr = createDateStr;
	}
}
